<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2018/5/20/020
 * Time: 18:28
 */

namespace app\api\validate;


class ProductValidate extends BaseValidate {
    protected $rule = [
        'name' => 'require',
        'image' => 'require',
        'price' => 'require|isFloatOrPositiveInteger',
        'category_id' => 'require|isPositiveInteger',
        'brand_id' => 'require|isPositiveInteger',
        'status' => 'require|in:1,2',
        'index' => 'require|in:0,1',
    ];


    protected $message=[
        'name.require' => '产品名称不能为空',
        'image.require' => '请上传产品图片',
        'price.require' => '产品价格不能为空',
        'price.isFloatOrPositiveInteger' => '产品价格格式错误',
        'status.require' => '请选择产品状态',
        'status.isFloatOrPositiveInteger' => '产品状态参数错误',
        'index.require' => '请选择是否首页推荐',
        'index.isFloatOrPositiveInteger' => '首页推荐参数错误',
    ];
}